<script setup>
import { articleGetChannelListService } from '@/api/article'
import { ref } from 'vue'
const channelList = ref([])
const getChannelList = async () => {
  const res = await articleGetChannelListService()
  channelList.value = res.data.data
  //   console.log(channelList.value)
}
getChannelList()

// 和父组件双向绑定
defineProps({
  modelValue: [Number, String],
  width: String
})
const emit = defineEmits(['update:modelValue'])
</script>
<template>
  <el-select
    :style="width ? `width: ${width}` : 'width: 200px'"
    :modelValue="modelValue"
    @update:modelValue="($event) => emit('update:modelValue', $event)"
  >
    <el-option
      v-for="channel in channelList"
      :key="channel.id"
      :label="channel.cate_name"
      :value="channel.id"
    ></el-option>
  </el-select>
</template>
